import React from 'react';
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { Icon, List, WhiteSpace, SearchBar, WingBlank } from 'antd-mobile';

const Item = List.Item;
const Brief = Item.Brief;

class zzadminister extends React.Component {

  constructor(props) {
    super(props);
    this.state = {}

  }

  //党建处跳转
  dangwu = (code, name) => {
    const data = {code: code, name: name};
    this.props.dispatch(
      routerRedux.push({
        pathname: "/work/zzadminister/partybuilding",
        query: data,
      })
    )
  };

  render() {
    const orgList = [];
    const orgData = this.props.list;
    for (let key in orgData) {
      orgList.push(orgData[key])
    }
    return (
      <div>
        <WhiteSpace/>
        <div style={{height: '2rem', backgroundColor: '#fff'}}>
          <WingBlank> <SearchBar placeholder="搜索" maxLength={8}/></WingBlank>
          <WingBlank>
            <div style={{marginTop: '0.5rem', color: '#5B91E6', fontSize: '0.35rem'}}>
              <a href="#" style={{color: '#5B91E6'}}> 机场集团</a>
            </div>
          </WingBlank>
        </div>
        <WhiteSpace/>
        <div>
          <List>

            {
              orgList.map((it) => {
                return <Item arrow="horizontal" onClick={()=>this.dangwu(it.code,it.name)}>
                  {it.name.length > 17 ? it.name.substring(0, 17) + "..." : it.name}
                  <span style={{marginLeft: '0.1rem', color: '#5B91E6', fontSize: '0.3rem'}}>(3人)</span>
                </Item>
              })
            }
          </List>
        </div>
      </div>
    )
  }
}
function mapStateToProps({organizationss}) {
    return {
      list: organizationss.orgLists
    }
}
export default connect(mapStateToProps)(zzadminister);
